const mongoose = require("mongoose");

const customerCouponSchema = new mongoose.Schema(
  {
    customer: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "CustomerData",
      required: true,
    },
    discountCoupon: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "DiscountCoupon",
      required: true,
    },
    
    couponCode: { type: String, default: "" },

   
    usedDate: { type: Date },
    status: {
      type: String,
      enum: ["Active", "Used", "Expired"],
      default: "Active",
    },
    
    occasionName: { type: String, default: "" },
    expiryDate: { type: Date }, 
    value: { type: Number },    
    couponType: { type: String, enum: ["percentage", "value"] },
    description: { type: String, default: "" },
  },
  { timestamps: true }
);

module.exports = mongoose.model("CustomerCoupon", customerCouponSchema);
